package com.ymatou.app.api.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

/**
 * 创建团Call FreeMaker Template自动生成代码
 */
public class GroupCreateCall extends YmatouBaseCall {
	private static String opurl = "api/Group/Create";

	public GroupCreateCall() {
		super(EnvSetup.getSystemUrl("api_app"), opurl, "POST", "PARAM");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept", "text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
	}

	/**
	 * 获取code
	 */
	public String getCode() {
		String Code = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Code = String.valueOf(jo.get("Code"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取BCode
	 */
	public String getBCode() {
		String BCode = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			BCode = String.valueOf(jo.get("BCode"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return BCode;
	}

	/**
	 * 获取Data
	 * 
	 * @return Data
	 */
	public JSONObject getData() {
		JSONObject Data = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Data = jo.getJSONObject("Data");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Data;
	}

	/**
	 * 获取Tuan
	 */
	public JSONObject getTuan() {
		JSONObject tuan = null;
		try {
			tuan = getData().getJSONObject("Tuan");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return tuan;
	}

	/**
	 * 获取Creator
	 */
	public String getCreator() {
		String Creator = null;
		try {
			Creator = getTuan().get("Creator").toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Creator;
	}

	/**
	 * 获取GroupCode
	 */
	public String getGroupCode() {
		String GroupCode = null;
		try {
			GroupCode = getTuan().get("GroupCode").toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return GroupCode;
	}

	/**
	 * 获取LeftTime
	 */
	public String getLeftTime() {
		String LeftTime = null;
		try {
			LeftTime = getTuan().get("LeftTime").toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return LeftTime;
	}

	/**
	 * 获取MemberNum
	 */
	public String getMemberNum() {
		String MemberNum = null;
		try {
			MemberNum = getTuan().get("MemberNum").toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return MemberNum;
	}

	/**
	 * 获取 Status
	 * 
	 * @return Status
	 */
	public String getStatus() {
		String Status2 = null;
		try {
			Status2 = String.valueOf(getData().get("Status"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Status2;
	}

	/**
	 * 获取 MemberStatus
	 * 
	 * @return MemberStatus
	 */
	public String getMemberStatus() {
		String MemberStatus = null;
		try {
			MemberStatus = String.valueOf(getData().get("MemberStatus"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return MemberStatus;
	}

	/**
	 * 获取 GroupStatus
	 * 
	 * @return GroupStatus
	 */
	public String getGroupStatus() {
		String GroupStatus = null;
		try {
			GroupStatus = String.valueOf(getData().get("GroupStatus"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return GroupStatus;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String Msg = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Msg = String.valueOf(jo.get("Msg"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Msg;
	}
}